{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Downloading Overlays\n",
    "\n",
    "This notebook demonstrates how to download an FPGA overlay and examine programmable logic state.  \n",
    "\n",
    "## 1. Instantiating an overlay\n",
    "With the following overlay bundle present in the `overlays` folder, users can instantiate the overlay easily.\n",
    "\n",
    "*  A bitstream file (\\*.bit).\n",
    "*  An hwh file (\\*.hwh).\n",
    "*  A python class (\\*.py).\n",
    "\n",
    "For example, an overlay called `base` can be loaded by:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "\n",
       "try {\n",
       "require(['notebook/js/codecell'], function(codecell) {\n",
       "  codecell.CodeCell.options_default.highlight_modes[\n",
       "      'magic_text/x-csrc'] = {'reg':[/^%%microblaze/]};\n",
       "  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){\n",
       "      Jupyter.notebook.get_cells().map(function(cell){\n",
       "          if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;\n",
       "  });\n",
       "});\n",
       "} catch (e) {};\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "try {\n",
       "require(['notebook/js/codecell'], function(codecell) {\n",
       "  codecell.CodeCell.options_default.highlight_modes[\n",
       "      'magic_text/x-csrc'] = {'reg':[/^%%pybind11/]};\n",
       "  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){\n",
       "      Jupyter.notebook.get_cells().map(function(cell){\n",
       "          if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;\n",
       "  });\n",
       "});\n",
       "} catch (e) {};\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from pynq.overlays.base import BaseOverlay\n",
    "\n",
    "ol = BaseOverlay(\"base.bit\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `BaseOverlay` class automatically downloads the bitstream, but it can re-downloaded by using the `download()` method."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "ol.download()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can check the download timestamp for this overlay."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2022/10/6 14:16:52 +710996'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ol.timestamp"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Examining the PL state\n",
    "\n",
    "While there can be multiple overlay instances in Python, there is only one bitstream that is currently loaded onto the programmable logic (PL). \n",
    "\n",
    "This bitstream state is held in the singleton class, PL, and is available for user queries."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pynq import PL"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can use this class to obtain the absolute path to the loaded bitstream and timestamp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlays/base/base.bit'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PL.bitfile_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2022/10/6 14:16:52 +710996'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PL.timestamp"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Users can verify whether an overlay instance is currently loaded using the Overlay `is_loaded()` method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ol.is_loaded()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Overlay downloading overhead\n",
    "\n",
    "Finally, using Python, we can see the bitstream download time over 50 downloads."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAX70lEQVR4nO3de7RdZX3u8e9jYoEACsTAgYSbxyiCo1XZIh4dlhYraD3COOfQEVttvFSqAyt66lCiPcf2tKlae1Fr0eI1HimcFC9EWiuIdyvijngLlxIFQ0okoYBArdTE3/ljvtushL2Tvdde2Zeu72eMNdZc75zvfN/17jCfNd851yJVhSRJD5ntDkiS5gYDQZIEGAiSpMZAkCQBBoIkqTEQJEmAgaAeSd6d5H/Ndj8GLclxSSrJwn2w788l+a22/BtJrhx0GxO0e0yS+5MsmKH2fjvJ2wa8z/2S3Jjk8EHuV/0zEIZIkluT/Fs7kNyd5O+SHD22vqpeVlV/2LY9LcnmSe53nx1w55Oquriqnrkv9t3+ds/oaWtTVR1UVTv2RXu7tf1zwO8Bbx3kfqvqAeD9wOsGuV/1z0AYPv+1qg4CjgTuAP5yJhod9rCY584Cbqyqf94H+/4bYGWS/fbBvjVFBsKQqqofA5cBJ46VJflgkj9KciDwSeCodjZxf5KjkpySZDTJvUnuSPLnreoX2vM9bdunJHlhki8n+YskdwG/36YI/jTJplb/3UkOaG0fmuSKJNva2csVSZb19O1zrW//2Nr4RJLFSS5u/flakuMm897be1mX5K4kG5O8tGfdKUm+kuSeJFuSvLN9Qh5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ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import time\n",
    "import matplotlib.pyplot as plt\n",
    "from pynq import Bitstream\n",
    "\n",
    "length = 50\n",
    "time_log = []\n",
    "for i in range(length):\n",
    "    start = time.time()\n",
    "    ol.download()\n",
    "    end = time.time()\n",
    "    time_log.append((end-start)*1000)\n",
    "\n",
    "%matplotlib inline\n",
    "plt.plot(range(length), time_log, 'ro')\n",
    "plt.title('Bitstream loading time (ms)')\n",
    "plt.axis([0, length, 0, 1200])\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
